// const {Emali} = require ('./maile/maile')
const {DownloadAddress,webSpiders,webSpider} = require('./Node-server/PicturesFor')  //图片获取
const {GetTheLink,GetTheLinks} = require('./Node-server/PageCollection') //页面获取
const fs1 = require('fs')
const readline = require('readline');


// Emali({ host: 'smtp.qq.com', //发送邮箱类型
//     port: 465,//端口号
//     secure: true, //true for 465, false for other ports
//     user: '1239184745@qq.com', //发送的邮箱地址
//     pass: 'sghycejeggmibabi' // mtp验证码
//   }, {
//     sendout: '开发者', //发送地址标题
//     addressee: '321071784@qq.com,1239184745@qq.com', //发送地址，可以多个以逗号隔开
//     sendtitle: '你的验证码', //发送标题
//     sendhtml: '<img src="http://imagse1.fcrenti.com/photo/picss/201928/201928212739625.jpg" alt="[MiStar魅妍社]2015.12.09 VOL.037 Moa小姐苏梅旅拍写真 少女" border="0"><img src="http://imagse1.fcrenti.com/photo/picss/201929/201929222834376.jpg" alt="[MiStar魅妍社]2016.02.03 VOL.059 FoxYini孟狐狸 辣妹" border="0">', //发送html内容
//     // sendtxt:'12350', //发送文本内容
//    }, (err: object, data: object) => {  //回调函数
//     if(err){
//       return console.log(err)
//     }
//     console.log(data)
// })


// webSpider({})
    // webSpiders({
    //     urlstr:'https://www.kaka1234.com/HTM/YouMi/2020/0411/48865_',
    //     urlend:'.html',
    //     // fileName:'www.kaka1234.com/HTM/YouMi/',   //文件夹目录https://diyifangfuli.com/764.html
    //      find:'img',
    //      findlabel:'img',
    //      link:'src',
    //      catalogue:'200411',
    //      flies:false,
    // },1,5)



// http://www.taotumowang.com/44744.html
// https://www.kaka1234.com/HTM/YouMi/2020/0411/48865_5.html

/** *********** 获取图片对应的页面************ */
// GetTheLink({
//     outer:'.main',
//     middle:'li',
//     content:'a'
//   },'http://www.918avc.com/?page=30');





// 读取文本的地址进行爬取
      // const fli = readline.createInterface({
      //   input: fs1.createReadStream("./dataCont/gather.txt")
      // });
      // fli.on('line',(line)=>{
        //   m.push(line)
        //   console.log(line)
        // webSpider({url:line,catalogue:'',Filelink:'src'})
        // console.log(m)
        // DownloadAddress(line)
      // })



// console.log('server.js  init')
 

/**
 * 有规律的网址 批量获取
 * outer 内容最外层
 *  middle 包裹内容层
 *  content  内容标签
 */
/**
 * 
 * http://fetishs.ml/category/bdsm/page/2
 * http://fetishs.ml/category/pantyhose/page/122
 * http://fetishs.ml/category/pantyhose/page/17
 */

GetTheLinks({
      outer:'.site-main',
      middle:'.entry-title',
      content:'a'
    },{
        start:'http://fetishs.ml/category/pantyhose/page/',
        end:'',
    },1,17,5000)








// let min=1
// const interval = setInterval(() => {
//     min++;
//     if (min === 17) {
//         clearInterval(interval);
//         console.log('网址采集完成');
//     }
//     webSpider({url:`http://fetishs.ml/category/pantyhose/page/${min}`,catalogue:'',Filelink:'src'})

// }, 3000);